<!--
// +----------------------------------------------------------------------
// | Created by PHPstorm: JRKAdmin框架 [ JRKAdmin ]
// +----------------------------------------------------------------------
// | Copyright (c) 2019~2022 [LuckyHHY] All rights reserved.
// +----------------------------------------------------------------------
// | SiteUrl: http://www.luckyhhy.cn
// +----------------------------------------------------------------------
// | Author: LuckyHhy <jackhhy520@qq.com>
// +----------------------------------------------------------------------
// | Date: 2020/3/1 0001
// +----------------------------------------------------------------------
// | Description:
// +----------------------------------------------------------------------
*-->
{extend name='public/window' /}

{block name="content"}

<link rel="stylesheet" href="__ADMIN__/css/admin.css?v=312">
<link rel="stylesheet" href="__ADMIN__/css/sub-page.css">
<link rel="stylesheet" href="__ADMIN__/css/fileCommon.css">

<style >

    @media screen and (max-width: 420px) {
        .btnDiv {
            padding-top: 30px;
            text-align: left;
        }
    }

    .showBB .bottomBar {
        display: block;
    }

</style >


<!-- 正文开始 -->
<div class="layui-fluid">
    <div class="layui-row layui-col-space10">
        <div class="layui-col-md12">

            <div class="layui-card">
                <div class="layui-card-body">

                    <div class="layui-form">

                        <div class="file-list">
                            {volist name="data.data" id="vo" empty="暂无附件素材"}
                            <div class="file-list-item"  data-url="{$vo['file_path']}" data-name="{$vo['filename']}" data-ext="{$vo['ext']}"   data-title="{$vo['filename']}">
                                <div class="file-list-img media " data-id="{$vo['id']}" >

                                    {in name='$vo.ext' value="zip,rar,7z"}
                                    <img class="lazy" alt="ss" data-original="__ADMIN__/ico/zip.png" />
                                    {/in}

                                    {eq name='$vo.ext' value="xls,xlsx"}
                                    <img class="lazy" alt="ss" data-original="__ADMIN__/ico/xls.png" />
                                    {/eq}
                                    {eq name='$vo.ext' value="doc,docx"}
                                    <img class="lazy" alt="ss" data-original="__ADMIN__/ico/doc.png" />
                                    {/eq}

                                    {eq name='$vo.ext' value="pdf"}
                                    <img class="lazy" alt="ss" data-original="__ADMIN__/ico/pdf.png" />
                                    {/eq}

                                    {eq name='$vo.ext' value="mp3"}
                                    <img class="lazy" alt="ss" data-original="__ADMIN__/ico/mp3.png" />
                                    {/eq}

                                    {eq name='$vo.ext' value="ppt"}
                                    <img class="lazy" alt="ss" data-original="__ADMIN__/ico/ppt.png" />
                                    {/eq}

                                    {eq name='$vo.ext' value="txt"}
                                    <img class="lazy" alt="ss" data-original="__ADMIN__/ico/txt.png" />
                                    {/eq}

                                    {in name='$vo.ext' value="mp4,mvw"}
                                    <img class="lazy" alt="ss" data-original="__ADMIN__/ico/mp4.png" />
                                    {/in}


                                    {eq name='$vo.ext' value="apk"}
                                    <img class="lazy" alt="ss" data-original="__ADMIN__/ico/apk.png" />
                                    {/eq}

                                    {eq name='$vo.ext' value="exe"}
                                    <img class="lazy" alt="ss" data-original="__ADMIN__/ico/exe.png" />
                                    {/eq}

                                    {eq name='$vo.ext' value="xmind"}
                                    <img class="lazy" alt="ss" data-original="__ADMIN__/ico/xmind.png" />
                                    {/eq}



                                </div>
                                <div class="file-list-name">{$vo['filename']}</div>
                                <div class="file-list-ck layui-form">
                                    <input type="radio" name="imgCk" value="{$vo['file_path']}" lay-skin="primary" />
                                </div>
                            </div>
                            {/volist}
                        </div>


                        <!--分页开始-->
                        <div class="layui-row" style="text-align: center;">
                            {$page|raw}
                        </div>
                        <!--分页结束-->


                        <div class="layui-form-item" >
                            <div class="layui-input-block">
                                <div class="layui-footer" style="left: 0px;text-align: right;">
                                    <button class="layui-btn" lay-submit="" lay-filter="add">确认选择</button>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>

    </div>
</div>
</div>



<script type="text/javascript" src="__ADMIN__/js/clipboard.min.js"></script>

<script type="text/javascript" src=__ADMIN__/js/jquery.lazyload.min.js?v=1.9.1"></script>

<script type="text/javascript" charset="utf-8">
    $(function() {
        $("img.lazy").lazyload({effect: "fadeIn",threshold: 100});
    });
</script>

<script>

    layui.use(['jquery', 'layer', 'element', 'upload',  'util' ,'form'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var element = layui.element;
        var upload = layui.upload;
        var util = layui.util;
        var form = layui.form;

        form.render();

        var mUrl; //素材地址
        var show; //素材类型
        var names; //原始名称
        var _id; //素材id
        // 列表点击事件
        $('body').on('click', '.file-list-item > .file-list-img', function (e) {
          /*  var name = $(this).parent().data('name');
            mUrl = $(this).parent().data('url');
            show=$(this).parent().data('ext');
            names=name;
            _id=parseInt( $(this).data('id'));*/

        });


        form.on('submit(add)', function (data) {

            var val=$('input:radio[name=imgCk]:checked').val();
            console.log(val);

            if (val==undefined || val===""){

                layer.msg("请选择一个附件",{kin: 'layui-layer-lan', icon:5,time:1500,shade:0.7});
                return  false;
            }
            parent.mFsUrls = val;
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        });

    });
</script>


{/block}